#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
const int maxn = 1e6 + 100;
bool dp[maxn];

void init() {//素数打表
    int n = 1e5 + 1;
    fill(dp, dp + n + 1, true);
    dp[0] = dp[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (dp[i]) {
            for (int j = i * i; j <= n; j += i) {
                dp[j] = false;
            }
        }
    }
}

bool check(int n) {
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {   //第一个i一定是素数
            return dp[n / i];//等价于n/i也是素数即可
        }
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    init();
    int T, n;

    for (cin >> T; T-- && cin >> n;) {
        if (check(n)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}
